<?php 
	session_start();
	$db = mysqli_connect("localhost","root","","ajax_form");
	$username = mysqli_real_escape_string($db,$_POST['name']);
	$password = mysqli_real_escape_string($db,$_POST['password']);
	$hash_pass = sha1($password);

	$query = "SELECT user_name,password FROM signup WHERE user_name='".$username."'";
	$result = mysqli_query($db,$query);
	$row = mysqli_fetch_array($result);

	if(mysqli_num_rows($result) > 0) {
		if(strcmp($row['password'],$hash_pass)==0) {
			echo "true";
			$_SESSION['user_name'] = $username;
		} else {
			echo "false";
		}
	} else {
		echo "false";
	}

?>